#ifndef EXIF_WRITER_H
#define EXIF_WRITER_H

#include <stdint.h>

// EXIF IFD类型
typedef enum {
    EXIF_IFD0 = 0,      // 主图像IFD
    EXIF_EXIF_IFD = 1,  // Exif IFD
    EXIF_GPS_IFD = 2    // GPS IFD
} exif_ifd_t;

// 常用EXIF标签
#define EXIF_TAG_MAKE              0x010F
#define EXIF_TAG_MODEL             0x0110
#define EXIF_TAG_ISO_SPEED_RATINGS 0x8827
#define EXIF_TAG_GPS_LATITUDE      0x0002
#define EXIF_TAG_GPS_LONGITUDE     0x0004
#define EXIF_TAG_GPS_LATITUDE_REF  0x0001
#define EXIF_TAG_GPS_LONGITUDE_REF 0x0003
#define EXIF_TAG_GPS_VERSION_ID    0x0000

// EXIF数据类型
typedef enum {
    EXIF_TYPE_BYTE = 1,
    EXIF_TYPE_ASCII = 2,
    EXIF_TYPE_SHORT = 3,
    EXIF_TYPE_LONG = 4,
    EXIF_TYPE_RATIONAL = 5
} exif_type_t;

// EXIF上下文结构
typedef struct exif_context exif_context_t;

// 函数声明
exif_context_t* exif_create_context(void);
void exif_destroy_context(exif_context_t* ctx);
int exif_add_string(exif_context_t* ctx, exif_ifd_t ifd, uint16_t tag, const char* value);
int exif_add_short(exif_context_t* ctx, exif_ifd_t ifd, uint16_t tag, uint16_t value);
int exif_add_long(exif_context_t* ctx, exif_ifd_t ifd, uint16_t tag, uint32_t value);
int exif_add_rational(exif_context_t* ctx, exif_ifd_t ifd, uint16_t tag, uint32_t numerator, uint32_t denominator);
int exif_add_gps_coordinates(exif_context_t* ctx, double latitude, double longitude);
int exif_write_to_file(exif_context_t* ctx, const char* input_file, const char* output_file);
void add_exif_data(const char* filename);

#endif // EXIF_WRITER_H 